<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use backend\models\Category;
use yii\helpers\ArrayHelper;

/* @var $this yii\web\View */
/* @var $model backend\models\Article */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="article-form">

    <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?>

    <?= $form->field($model, 'cid')->dropDownList(
      ArrayHelper::map(Category::findAll(['pid' => 10]), 'id', 'title'),
      ['prompt' => '选择分类']
    ) ?>

    <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>

    <?php if($model->thumb){?>
    <img src="http://gaqxadmin.apiary.com.cn/<?= $model->thumb?>" class="img-responsive" style="height:200px">
    <?php }?>
    <?= $form->field($model, 'thumb')->fileInput() ?>

    <?= $form->field($model, 'content')->widget('kucha\ueditor\UEditor',[ ]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '添加' : '更新', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
